#include "firstwidget.h"
#include "ui_firstwidget.h"

FirstWidget::FirstWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FirstWidget)
{
    ui->setupUi(this);
    this->resize(600,800);
    label =  new QLabel(tr("this is First"),this);
    label->move(300,400);
    secondBtn = new QPushButton(tr("go to Second"),this);
    secondBtn ->move(300,500);
    mainBtn = new QPushButton(tr("back to Main"),this);
    mainBtn ->move(300,600);
    connect(secondBtn,&QPushButton::clicked,
            this,&FirstWidget::gotoSecond);
    connect(mainBtn,&QPushButton::clicked,
            this,&FirstWidget::gotoMain);
}

FirstWidget::~FirstWidget()
{
    delete ui;
}

void FirstWidget::gotoSecond()
{
    this->hide();
    emit firstToSecond();
}

void FirstWidget::gotoMain()
{
    this->hide();
    emit firstToMain();
}


